import request from "@/utils/request";

class AuthAPI {
  // 注册
  static signUp(data) {
    return request.post("/auth/signup", data, {
      custom: {
        loading: true,
      },
    });
  }

  // 登录
  static signIn(data) {
    // return request.post("/auth/app/login", data, {
    //   custom: {
    //     loading: true,
    //   },
    // });
    return request.post("/login", data, {
      custom: {
        loading: true,
      },
    });
  }

  // 刷新token
  static refreshToken(header = {}) {
    return request.post("/auth/refresh", undefined, {
      header,
    });
  }

  // 发送验证码
  static sendCode(phone) {
    return request.get(`/sendCode/${phone}`, {
      custom: {
        loading: true,
      },
    });
  }

  //重置密码
  static retrieve(data) {
    return request.post("/retrieve", data, {
      custom: {
        loading: true,
      },
    });
  }
}

export default AuthAPI;
